
#include "QueryProcessor.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;


	void main () {
		//read in source file
		ifstream sourceFile;
		string fileName, source = "", line;
		cout << "Name of source file: ";
		getline(cin, fileName);
		sourceFile.open(fileName);

		if ( sourceFile.is_open() ) {
			while ( getline(sourceFile, line) ) {
				source = source + line + " ";
			}
		}
		else {
			cout << "Cannot open file" <<endl;
		}

		sourceFile.close();

		cout << source << endl;

		//parse the source file
		//Parser::parse(source);
		
		bool repeat = true;
		string query;
		//while there are still queries
		//read in querys
		while (repeat) {
			cout << "Enter query: " <<endl;
			getline(cin, query);

			 cout << QueryProcessor::setQuery(query) << endl;
			 QueryProcessor::getResult();
			 cout << QueryProcessor::organizeResult() <<endl;
		}
		//output results
	}
